package com.njh.charges.factory;

import com.hos.entity.stock.Medicines;
import com.njh.charges.feigns.MedicinesFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author: 陈海彬
 * @date: Created in 2023/12/14 16:19
 * @description:
 * @modified By:
 * @version:
 */
@Component
@Slf4j
public class MedicinesFeignFallbackFactory implements FallbackFactory<MedicinesFeign> {
    @Override
    public MedicinesFeign create(Throwable throwable) {
        return new MedicinesFeign() {
            @Override
            public boolean reducePharmaceuticalById(Medicines medicines) {
                log.error("药品库存减少出现异常");
                return false;
            }

            @Override
            public boolean addPharmaceuticalById(Medicines medicines) {
                log.error("药品库存增加出现异常");
                return false;
            }
        };
    }
}